﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Esint.BLL.Common
{
    public class CommonBLL
    {
        public string GetFileSizeStr(float fileSize)
        {
            string sizeStr ="Byte";
            if (fileSize>1024)
            {
                fileSize = fileSize / 1024f;
                sizeStr = "KB";
            }
            if (fileSize>1024)
            {
                fileSize = fileSize / 1024f;
                sizeStr = "MB";
            }
            sizeStr = Math.Round(fileSize,2).ToString() + sizeStr;
            return sizeStr;
        }

        public static string GetOsName(string Agent)
        {
            // string Agent = 

            if (Agent.IndexOf("NT 4.0") > 0)
            {
                return "Windows NT ";
            }
            else if (Agent.IndexOf("NT 5.0") > 0)
            {
                return "Windows 2000";
            }
            else if (Agent.IndexOf("NT 5.1") > 0)
            {
                return "Windows XP";
            }
            else if (Agent.IndexOf("NT 5.2") > 0)
            {
                return "Windows 2003";
            }
            else if (Agent.IndexOf("NT 6.0") > 0)
            {
                return "Windows Vista";
            }
            else if (Agent.IndexOf("NT 6.1") > 0)
            {
                return "Windows7";
            }
            else if (Agent.IndexOf("NT 6.2") > 0)
            {
                return "Windows8";
            }
            else if (Agent.IndexOf("WindowsCE") > 0)
            {
                return "Windows CE";
            }
            else if (Agent.IndexOf("NT") > 0)
            {
                return "Windows NT ";
            }
            else if (Agent.IndexOf("9x") > 0)
            {
                return "Windows ME";
            }
            else if (Agent.IndexOf("98") > 0)
            {
                return "Windows 98";
            }
            else if (Agent.IndexOf("95") > 0)
            {
                return "Windows 95";
            }
            else if (Agent.IndexOf("Win32") > 0)
            {
                return "Win32";
            }
            else if (Agent.IndexOf("Linux") > 0)
            {
                return "Linux";
            }
            else if (Agent.IndexOf("SunOS") > 0)
            {
                return "SunOS";
            }
            else if (Agent.IndexOf("Mac") > 0)
            {
                return "Mac";
            }
            else if (Agent.IndexOf("Linux") > 0)
            {
                return "Linux";
            }
            else if (Agent.IndexOf("Windows") > 0)
            {
                return "Windows";
            }
            return Agent;

        }  

    }
}
